home *** CD-ROM | disk | FTP | other *** search
-
-
-
- SEMOP C Library Procedures SEMOP
-
-
-
- NNAAMMEE
- semop - semaphore operations
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<ssyyss//ttyyppeess..hh>>
- ##iinncclluuddee <<ssyyss//iippcc..hh>>
- ##iinncclluuddee <<ssyyss//sseemm..hh>>
-
- iinntt sseemmoopp((sseemmiidd,, ssooppss,, nnssooppss))
- iinntt sseemmiidd;;
- ssttrruucctt sseemmbbuuff **ssooppss;;
- iinntt nnssooppss;;
-
- DDEESSCCRRIIPPTTIIOONN
- sseemmoopp(()) is used to atomically perform an array of semaphore
- operations on the set of semaphores associated with the
- semaphore identifier specified by _s_e_m_i_d. _s_o_p_s is a pointer
- to the array of semaphore-operation structures. _n_s_o_p_s is
- the number of such structures in the array. The contents of
- each structure includes the following members:
-
- sshhoorrtt sseemm__nnuumm;; //** sseemmaapphhoorree nnuummbbeerr **//
- sshhoorrtt sseemm__oopp;; //** sseemmaapphhoorree ooppeerraattiioonn **//
- sshhoorrtt sseemm__ffllgg;; //** ooppeerraattiioonn ffllaaggss **//
-
- Each semaphore operation specified by sseemm__oopp is performed on
- the corresponding semaphore specified by _s_e_m_i_d and sseemm__nnuumm.
-
- sseemm__oopp specifies one of three semaphore operations as fol-
- lows:
-
- If sseemm__oopp is a negative integer, one of the follow-
- ing will occur: {{AALLTTEERR}}
-
- o+ If _s_e_m_v_a_l (see iinnttrroo(2)) is greater than or
- equal to the absolute value of sseemm__oopp, the
- absolute value of sseemm__oopp is subtracted from
- _s_e_m_v_a_l.
-
- o+ If _s_e_m_v_a_l is less than the absolute value of
- sseemm__oopp and (sseemm__ffllgg & IIPPCC__NNOOWWAAIITT) is ``true'',
- sseemmoopp(()) will return immediately.
-
- o+ If _s_e_m_v_a_l is less than the absolute value of
- sseemm__oopp and (sseemm__ffllgg & IIPPCC__NNOOWWAAIITT) is ``false'',
- sseemmoopp(()) will increment the _s_e_m_n_c_n_t associated
- with the specified semaphore and suspend execu-
- tion of the calling process until one of the
- following conditions occur.
-
- _s_e_m_v_a_l becomes greater than or equal to
- the absolute value of sseemm__oopp. When this
-
-
-
- Sprite v1.0 21 November 1987 1
-
-
-
-
-
-
- SEMOP C Library Procedures SEMOP
-
-
-
- occurs, the value of _s_e_m_n_c_n_t associated
- with the specified semaphore is decre-
- mented, the absolute value of _s_e_m__o_p is
- subtracted from _s_e_m_v_a_l .
-
- The _s_e_m_i_d for which the calling process
- is awaiting action is removed from the
- system (see sseemmccttll(2)). When this
- occurs, eerrrrnnoo is set equal to EIDRM, and
- a value of -1 is returned.
-
- The calling process receives a signal.
- When this occurs, the value of _s_e_m_n_c_n_t
- associated with the specified semaphore
- is decremented, and the calling process
- resumes execution in the manner
- prescribed in ssiiggnnaall(2).
-
- If sseemm__oopp is a positive integer, the value of sseemm__oopp
- is added to _s_e_m_v_a_l . {{AALLTTEERR}}
-
- If sseemm__oopp is zero, one of the following will occur:
- {{RREEAADD}}
-
- o+ If _s_e_m_v_a_l is zero, sseemmoopp(()) will return immedi-
- ately.
-
- o+ If _s_e_m_v_a_l is not equal to zero and (sseemm__ffllgg &
- IIPPCC__NNOOWWAAIITT) is ``true'', sseemmoopp(()) will return
- immediately.
-
- o+ If _s_e_m_v_a_l is not equal to zero and (sseemm__ffllgg &
- IIPPCC__NNOOWWAAIITT) is ``false'', sseemmoopp(()) will incre-
- ment the _s_e_m_z_c_n_t associated with the specified
- semaphore and suspend execution of the calling
- process until one of the following occurs:
-
- _s_e_m_v_a_l becomes zero, at which time the
- value of _s_e_m_z_c_n_t associated with the
- specified semaphore is decremented.
-
- The _s_e_m_i_d for which the calling process
- is awaiting action is removed from the
- system. When this occurs, eerrrrnnoo is set
- equal to EIDRM, and a value of -1 is
- returned.
-
- The calling process receives a signal
- that is to be caught. When this occurs,
- the value of _s_e_m_z_c_n_t associated with the
- specified semaphore is decremented, and
- the calling process resumes execution in
-
-
-
- Sprite v1.0 21 November 1987 2
-
-
-
-
-
-
- SEMOP C Library Procedures SEMOP
-
-
-
- the manner prescribed in ssiiggnnaall(2).
-
- Upon successful completion, the value of _s_e_m_p_i_d for each
- semaphore specified in the array pointed to by _s_o_p_s is set
- equal to the process ID of the calling process.
-
- RREETTUURRNN VVAALLUUEE
- Upon successful completion, the value of _s_e_m_v_a_l at the time
- of the call for the last operation in the array pointed to
- by _s_o_p_s is returned. Otherwise, a value of -1 is returned
- and eerrrrnnoo is set to indicate the error.
-
- EERRRROORRSS
- sseemmoopp(()) will fail if one or more of the following are true
- for any of the semaphore operations specified by _s_o_p_s:
-
- EINVAL _s_e_m_i_d is not a valid semaphore identif-
- ier.
-
- EIDRM The set of semaphores referred to by
- _m_s_q_i_d was removed from the system.
-
- EFBIG sseemm__nnuumm is less than zero or greater
- than or equal to the number of sema-
- phores in the set associated with _s_e_m_i_d.
-
- E2BIG _n_s_o_p_s is greater than the system-imposed
- maximum.
-
- EACCES Operation permission is denied to the
- calling process (see iinnttrroo(2)).
-
- EAGAIN The operation would result in suspension
- of the calling process but (sseemm__ffllgg &
- IIPPCC__NNOOWWAAIITT) is ``true''.
-
- ERANGE An operation would cause a _s_e_m_v_a_l value
- to overflow the system-imposed limit.
-
- EFAULT _s_o_p_s points to an illegal address.
-
- EINTR The call was interrupted by the delivery
- of a signal.
-
- SSEEEE AALLSSOO
- eexxeecc(2), eexxiitt(2), ffoorrkk(2), iinnttrroo(2), sseemmccttll(2), sseemmggeett(2),
- ssiiggnnaall(2)
-
- BBUUGGSS
- The SEM_UNDO function is not implemented.
-
- Semaphores always exit with EINTR when a signal is received.
-
-
-
- Sprite v1.0 21 November 1987 3
-
-
-
-
-
-
- SEMOP C Library Procedures SEMOP
-
-
-
- The signal cannot be caught inside the semaphore.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Sprite v1.0 21 November 1987 4
-
-
-
-